import request from "@/utiles/request";

export const getUserChannelAPI = () => {
  return request.get("/user/channels");
};

// 根据频道ID请求频道下的文章列表数据
export const getArtListAPI = (id, time) => {
  return request.get("/articles", {
    params: {
      channel_id: id,
      timestamp: time,
    },
  });
};
// 将文章设置问不感兴趣
export const dislikeArticleAPI = (id) => {
  return request.post("/article/dislikes", {
    target: id,
  });
};

// 举报文章的 API
export const reportArticleAPI = (target, type) => {
  return request.post("/article/reports", {
    target, // 文章的 Id
    type, // 举报的类型
  });
};

// 获取所有频道数据的 API
export const getAllChannelAPI = () => {
  return request.get("/channels");
};

export const updateUserChannelAPI = (channels) => {
  return request.put("/user/channels", {
    channels,
  });
};
